package com.gouqi.mall.service.impl;


import com.gouqi.mall.domain.Suggestion;
import com.gouqi.mall.mapper.SuggeationMapper;
import com.gouqi.mall.service.SuggestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class SuggestionServiceImpl implements SuggestionService {
    @Autowired
    private SuggeationMapper mapper;

    @Override
    public Integer addSuggestion(Suggestion suggestion) {
        return mapper.addSuggestion(suggestion);
    }

    @Override
    public List<Suggestion> getAllSuggestions(Integer indexPage,Integer perPage) {
        Integer startIndex = (indexPage - 1)*perPage;
        System.out.println("数据库起始索引："+startIndex);
        return mapper.getAllSuggestions(startIndex,perPage);
    }

    @Override
    public Integer countSuggestions() {
        return mapper.countSuggestions();
    }
}
